<?php 


if($show_header == TRUE) {

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="Enter your field names, types and rules and FormIgniter will generate all the code, saving you hours. Never hand code a form again!" />
<title>FormIgniter / @lemil Fork</title>     
   
<style type='text/css' media='all'>@import url('<?=BASE_URL()?>/assets/css/core.css');</style>
<script type='text/javascript' src='<?=BASE_URL()?>/assets/js/jquery-1.5.1.min.js'></script>
<script type='text/javascript' src='<?=BASE_URL()?>/assets/js/initial_form.js'></script>

</head>
<body style="overflow-y: scroll;">

<div id="container">

<div id="header">
<span class="title"><a href="http://formigniter.org">FormIgniter, field template / @lemil Fork</a></span>
</div>




<?php 
}






?>


<script>

var field_data<?php echo $count ?> = <?php echo field_data; ?> 

</script>

<?php
$box_error = NULL;

if (form_error("view_field_label{$count}") != NULL || form_error("view_field_name{$count}") != NULL || form_error("view_field_type{$count}") != NULL || form_error("db_field_type{$count}") != NULL || form_error("db_field_length_value{$count}") != NULL || form_error('cont_validation_rules'.$count.'[]') != NULL) // detect an form_validtion error message and change background if one occurs
{
	$box_error = 'background: #FBE6F2 !important; border: 1px solid #D893A1 !important;';
}

?>
<div class="container_blue" style="margin-right: 10px;<?php echo $box_error; ?>">  

<div class="field_form">
 
<div class="type_heading sub">
<span>Field <?php echo $count; ?> <?php if ($box_error != NULL) { echo ' - <b>Error needs fixing!</b>'; } ?></span>
<span class="right field-bar-button" onclick="displaypreview('<?php echo $count; ?>', true, true)"   ><img src="/formigniter/assets/images/preview.png" /></span>

<!-- Preview -->
<div id="preview_screen" class="preview_window" >
<div class="preview_tooltip"></div>
<div class="preview_frame">
<iframe src="http://www.bing.com/fd/hpk2/AlligatorFloat_ROW1739112056.jpg" width="340" height="240" frameborder="0"></iframe>
</div>
</div>

</div>

<?php echo form_error("view_field_label{$count}"); ?>
<?php echo form_error("view_field_name{$count}"); ?>
<?php echo form_error("view_field_type{$count}"); ?>


<div class="input_box">
<label for="view_field_label<?php echo $count; ?>">Label</label>
<input name="view_field_label<?php echo $count; ?>" id="view_field_label<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_label{$count}"); ?>" onkeyup="liveUrlTitle(<?php echo $count; ?>);" />
</div>

<div class="input_box">
<label for="view_field_name">Name (no spaces)</label>
<input name="view_field_name<?php echo $count; ?>" id="view_field_name<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_name{$count}"); ?>" maxlength="30" />
</div>

<div class="input_box">
<label for="view_field_type<?php echo $count; ?>">Type</label>
<?php
$view_field_types = array( 'none'		=> '&lt;Choose one&gt;',
                        'input' 		=> 'Text Input',
						'textarea' 		=> 'Text Area',
                        'dropdown' 		=> 'Dropdown List',
                        'radio' 		=> 'Radio buttons',
                        'checkbox' 		=> 'Checkbox',
                        'checkboxgroup'	=> 'Checkbox Group',
                        'paragraph' 	=> 'Paragraph',
                        'button'		=> 'Button'	
                        );
                        
                        
$opts = ' onchange="switch_options(this.value, ' . $count . ' , \'target_field_type_options\');" ';
                     
?><?php echo form_dropdown("view_field_type{$count}", $view_field_types, set_value("view_field_type{$count}") , $opts); ?>
</div>


<div class="input_box">
<label for="validation_required<?php echo $count; ?>" >Validations</label>

<?php echo form_error('validation_required'.$count); ?>
<input type="checkbox" name="validation_required<?php echo $count; ?>" id="validation_required<?php echo $count; ?>" value="required" <?php echo set_checkbox('validation_required'.$count , 'required'); ?>  /> 
<span for="validation_required<?php echo $count; ?>">required</span>&nbsp;&nbsp;

<input type="checkbox" name="validation_trim<?php echo $count; ?>" id="validation_trim<?php echo $count; ?>" value="trim" <?php echo set_checkbox('validation_trim'.$count, 'trim'); ?> /> 
<span for="validation_trim<?php echo $count; ?>">trim</span>&nbsp;&nbsp;

<input type="checkbox" name="validation_xssclean<?php echo $count; ?>" id="validation_xssclean<?php echo $count; ?>" value="xss_clean" <?php echo set_checkbox('validation_xssclean'.$count, 'xss_clean'); ?> /> 
<span for="validation_xssclean<?php echo $count?>">xss_clean</span>&nbsp;&nbsp;
</div>

<div class="input_box">
<label for="view_field_id<?php echo $count; ?>">Id</label>
<input name="view_field_id<?php echo $count; ?>" id="view_field_id<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_id{$count}"); ?>" />
</div>

<div class="input_box">
<label for="view_field_class<?php echo $count; ?>">Css Class</label>
<input name="view_field_class<?php echo $count; ?>" id="view_field_class<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_class{$count}"); ?>"  />
</div>




<!--
<br/>
<div class="type_heading">Specific field type options</div>
-->
<div></div>
<div id="target_field_type_options<?php echo $count; ?>" ></div>

<div class="hidden">


<!-- Button Options -->



<!-- Paragraph  Options -->
<div class="form_type_options"   id="form_type_options_paragraph<?php echo $count; ?>" >
<span class="title_d">Paragraph Options</span>
<div class="input_box">
<label for="view_field_paragraph_layout<?php echo $count; ?>">Layout</label>
<?php
$view_field_paragraph_layouts = array('simple' => 'Simple', 'boxed' => 'Boxed');
?><?php echo form_dropdown("view_field_paragraph_layout{$count}", $view_field_paragraph_layouts, set_value("view_field_paragraph_layout{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_paragraph_layout_boxed_rows<?php echo $count; ?>">Rows</label>
<?php
$view_field_paragraph_layout_boxed_rowss = array();
for($i = 1 ; $i < 25 ; $i++){
	$view_field_paragraph_layout_boxed_rowss[$i] = $i;
}
?><?php echo form_dropdown("view_field_paragraph_layout_boxed_rows{$count}", $view_field_paragraph_layout_boxed_rowss, set_value("view_field_paragraph_layout_boxed_rows{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_paragraph_text<?php echo $count; ?>">Text</label>
<textarea name="view_field_paragraph_text<?php echo $count; ?>" id="view_field_paragraph_text<?php echo $count; ?>" rows="1" cols="10" ></textarea>&nbsp;<button name="button_view_field_paragraph_text<?php echo $count; ?>" >Edit</button>
</div>


</div>








<!-- Checkbox group Options -->
<div class="form_type_options"  id="form_type_options_checkboxgroup<?php echo $count; ?>" >
<span class="title_d">Checkbox Group Options</span>
<div class="input_box">
<label for="view_field_checkboxgroup_layout<?php echo $count; ?>">Layout</label>
<?php
$view_field_checkboxgroup_layouts = array('horizontal' => 'Horizontal', 'vertical' => 'Vertical');
?><?php echo form_dropdown("view_field_checkboxgroup_layout{$count}", $view_field_checkboxgroup_layouts, set_value("view_field_checkboxgroup_layout{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_checkboxgroup_options<?php echo $count; ?>">Options</label>
<textarea name="view_field_checkboxgroup_options<?php echo $count; ?>" id="view_field_checkboxgroup_options<?php echo $count; ?>" cols="10" rows="1" ></textarea>&nbsp;<button name="button_view_field_checkboxgroup_options<?php echo $count; ?>" >Edit</button>
</div>


</div>


<!-- Checkbox Options -->



<!-- Radiobutton group Options -->
<div class="form_type_options"   id="form_type_options_radio<?php echo $count; ?>" >
<span class="title_d">Radiobutton Group Options</span>
<div class="input_box">
<label for="view_field_radio_layout<?php echo $count; ?>">Layout</label>
<?php
$view_field_radio_layouts = array('horizontal' => 'Horizontal', 'vertical' => 'Vertical');
?><?php echo form_dropdown("view_field_radio_layout{$count}", $view_field_radio_layouts, set_value("view_field_radio_layout{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_radio_options<?php echo $count; ?>">Options</label>
<textarea name="view_field_radio_options<?php echo $count; ?>" id="view_field_radio_options<?php echo $count; ?>" rows="1" cols="10" ></textarea>&nbsp;<button name="button_view_field_radio_options<?php echo $count; ?>" >Edit</button>
</div>

</div>



<!-- Dropdown List Options -->
<div class="form_type_options"   id="form_type_options_dropdown<?php echo $count; ?>" >
<span class="title_d">Dropdown List Options</span>
<div class="input_box">
<label for="view_field_dropdown_rows<?php echo $count; ?>">Rows</label>
<?php
$view_field_dropdown_rowss = array();
for($i = 1 ; $i < 51 ; $i++){
	$view_field_dropdown_rowss[$i] = $i;
}
?><?php echo form_dropdown("view_field_dropdown_rows{$count}", $view_field_dropdown_rowss, set_value("view_field_dropdown_rows{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_dropdown_options<?php echo $count; ?>">Options</label>
<textarea name="view_field_dropdown_options<?php echo $count; ?>" id="view_field_dropdown_options<?php echo $count; ?>" rows="1" cols="10" ></textarea>&nbsp;<button name="view_field_dropdown_options<?php echo $count; ?>" >Edit</button>
</div>

<div class="input_box">
<input type="checkbox" name="view_field_dropdown_multiselect<?php echo $count; ?>" id="view_field_dropdown_multiselect<?php echo $count; ?>" value="multiselect" <?php echo set_checkbox('view_field_dropdown_multiselect'.$count.'[]', 'multiselect'); ?> /> 
<span for="view_field_dropdown_multiselect<?php echo $count; ?>">Multiple</span>
</div>

</div>





<!-- Textarea Options -->
<div class="form_type_options"   id="form_type_options_textarea<?php echo $count; ?>"  >
<span class="title_d">Text Area Options</span>
<div class="input_box">
<label for="view_field_textarea_maxsize<?php echo $count; ?>">Max text size</label>
<input name="view_field_textarea_maxsize<?php echo $count; ?>" id="view_field_textarea_maxsize<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_textarea_maxsize{$count}"); ?>" />
</div>

<div class="input_box">
<label for="view_field_textarea_rows<?php echo $count; ?>">Rows</label>
<?php
$view_field_textarea_rowss = array();
for($i = 1 ; $i < 21 ; $i++){
	$view_field_textarea_rowss[$i] = $i;
}
?><?php echo form_dropdown("view_field_textarea_rows{$count}", $view_field_textarea_rowss, set_value("view_field_textarea_rows{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_textarea_columns<?php echo $count; ?>">Columns</label>
<?php
$view_field_textarea_columnss = array();
for($i = 1 ; $i < 21 ; $i++){
	$view_field_textarea_columnss[$i] = $i;
}
?><?php echo form_dropdown("view_field_textarea_columns{$count}", $view_field_textarea_columnss, set_value("view_field_textarea_columns{$count}") ); ?>
</div>
</div>


<!-- Text Input Options -->
<div class="form_type_options"  id="form_type_options_input<?php echo $count; ?>" >
<span class="title_d">Text Input Options</span>
<div class="input_box">
<label for="view_field_input_size<?php echo $count; ?>">Size</label>
<?php
$view_field_input_sizes = array();
for($i = 1 ; $i < 255 ; $i++){
	$view_field_input_sizes[$i] = $i;
}
?><?php echo form_dropdown("view_field_input_size{$count}", $view_field_input_sizes, set_value("view_field_input_size{$count}") ); ?>
</div>

<div class="input_box">
<label for="view_field_input_datatype<?php echo $count; ?>">Data type</label>
<?php
$view_field_input_datatypes = array(
                        'text' 		=> 'Any Text',
                        'password'	=> 'Password',
                        'hidden'	=> 'Hidden',
                        'numeric' 	=> 'Integer',
                        'decimal' 	=> 'Decimal',
                        'email' 	=> 'Email',
                        'url' 		=> 'Url',
                        'regex' 	=> 'Regex'	
                        );
?><?php echo form_dropdown("view_field_input_datatype{$count}", $view_field_input_datatypes, set_value("view_field_input_datatype{$count}")); ?>
</div>

<div class="input_box">
<label for="view_field_input_datatype_regex<?php echo $count; ?>">Regex</label>
<input name="view_field_input_datatype_regex<?php echo $count; ?>" id="view_field_input_datatype_regex<?php echo $count; ?>" type="text" value="<?php echo set_value("view_field_input_datatype_regex{$count}"); ?>" />&nbsp;<button name="button_view_field_input_datatype_regex<?php echo $count; ?>" >Edit</button>
</div>
</div>

</div> <!-- end hidden -->


<div class="u">
<span class="title_d" ><a  href="#" onclick="switch_link ('field_options',<?php echo $count; ?>, this )" class="notxt more" >More</a></span>
</div>

<br/>

<div id="field_options<?php echo $count; ?>" class="hidden" >
<span class="title_d" >Field options</span>


<div class="input_box">
<label for="view_field_footnote<?php echo $count; ?>">Field footnotes</label>
<textarea name="view_field_footnote<?php echo $count; ?>" id="view_field_footnote<?php echo $count; ?>" rows="1" cols="10" ></textarea>&nbsp;<button name="button_view_field_footnote<?php echo $count; ?>" >Edit</button>
</div>

<div class="input_box">
<label for="view_field_label_footnote<?php echo $count; ?>">Field label footnotes</label>
<textarea name="view_field_label_footnote<?php echo $count; ?>" id="view_field_label_footnote<?php echo $count; ?>" rows="1" cols="10" ></textarea>&nbsp;<button name="button_view_field_label_footnote<?php echo $count; ?>" >Edit</button>
</div>


<?php echo form_error("db_field_type{$count}"); ?>
<?php echo form_error("db_field_length_value{$count}"); ?>

<div class="input_box">
<label for="db_field_type<?php echo $count; ?>">DB Type</label>

<?php
$db_field_types = array('default'		=> '&lt;Use defaults&gt;',
						'VARCHAR' 		=> 'VARCHAR',
						'TINYINT' 		=> 'TINYINT',
						'TEXT' 			=> 'TEXT',
						'DATE' 			=> 'DATE',
						'SMALLINT' 		=> 'SMALLINT',
						'MEDIUMINT' 	=> 'MEDIUMINT',
						'INT' 			=> 'INT',
						'BIGINT' 		=> 'BIGINT',
						'FLOAT' 		=> 'FLOAT',
						'DOUBLE' 		=> 'DOUBLE',
						'DECIMAL' 		=> 'DECIMAL',
						'DATETIME' 		=> 'DATETIME',
						'TIMESTAMP' 	=> 'TIMESTAMP',
						'TIME' 			=> 'TIME',
						'YEAR' 			=> 'YEAR',
						'CHAR' 			=> 'CHAR',
						'TINYBLOB' 		=> 'TINYBLOB',
						'TINYTEXT' 		=> 'TINYTEXT',
						'BLOB' 			=> 'BLOB',
						'MEDIUMBLOB' 	=> 'MEDIUMBLOB',
						'MEDIUMTEXT' 	=> 'MEDIUMTEXT',
						'LONGBLOB' 		=> 'LONGBLOB',
						'LONGTEXT' 		=> 'LONGTEXT',
						'ENUM' 			=> 'ENUM',
						'SET' 			=> 'SET',
						'BIT' 			=> 'BIT',
						'BOOL' 			=> 'BOOL',
						'BINARY' 		=> 'BINARY',
						'VARBINARY' 	=> 'VARBINARY'
                        );
                        
$opts = ' onclick="conditional_display(\'div_db_field_length_value' . $count . '\', this.value, \'default\', false)"   onchange="conditional_display(\'div_db_field_length_value' . $count . '\', this.value, \'default\', false)" ';

?><?php echo form_dropdown("db_field_type{$count}", $db_field_types, set_value("db_field_type{$count}"), $opts); ?>
</div>

<div class="input_box" style="display:none;"  id="div_db_field_length_value<?php echo $count; ?>" >
<label for="db_field_length_value<?php echo $count; ?>">Field Length</label>
<input name="db_field_length_value<?php echo $count; ?>" type="text" value="<?php echo set_value("db_field_length_value{$count}"); ?>" />
</div>

<div class="input_box">
<label for="db_field_length_default<?php echo $count; ?>">Default</label>
<input name="db_field_length_default<?php echo $count; ?>" type="text" value="<?php echo set_value("db_field_length_default{$count}"); ?>" />
</div>

</div>

</div>



</div>


<script >

field_form_populate('<?php echo $count ?>');
switch_options( $("[name=view_field_type<?php echo $count ?>]").val() , '<?php echo $count ?>' , "target_field_type_options");

</script>

